<?
	session_start();
   include('conn.php');
    include('protect.php');	   
    include('gettopmenu.php');
    
	$_SESSION['custid']=0;
	$_SESSION['subid']=0;
	$_SESSION['bid']=0;
	$_SESSION['fromdt']='01-01-1999';
	$_SESSION['todt']='01-01-2025';

	if(isset($_REQUEST['custid']))
	{
		$_SESSION['custid']=$_REQUEST['custid'];
	}
	else
	{
		$_SESSION['custid']=0;
	}

   if(isset($_REQUEST['bid']))
	{
		$_SESSION['bid']=$_REQUEST['bid'];
	}
	else
	{
		$_SESSION['bid']=0;
	}

  if(isset($_REQUEST['subid']))
	{
		$_SESSION['subid']=$_REQUEST['subid'];
	}
	else
	{
		$_SESSION['subid']=0;
	}

  if(strlen($_REQUEST['fromdt'])>1)
	{
		$_SESSION['fromdt']=$_REQUEST['fromdt'];
	}
	else
	{
		$_SESSION['fromdt']='01-01-1999';
	}
	if(strlen($_REQUEST['todt'])>1)
	{
		$_SESSION['todt']=$_REQUEST['todt'];
	}
	else
	{
		$_SESSION['todt']='01-01-2025';
	}
	
	if($_SESSION['fromdt']=='01-01-1999')
	//if($_SESSION['fromdt']=='01-10-2014')
		$f='';
	else
		$f=	$_SESSION['fromdt'];
		
	if($_SESSION['todt']=='01-01-2025')
		$t='';
	else
		$t=	$_SESSION['todt'];

?>
     <script type="text/javascript" src="main_viewgriddata.js"></script>
	 <script type="text/javascript" src="ng-grid-csv-export.js"></script>
     <script language="javascript">
	
      function deletedata(name0)
       {
        alert(" Reference no to be deleted is: " + name0);

	if (confirm('Do you really want to delete this record?'))
      {
		$.post( "trandelete.php?", { id: name0})
        	.done(function( data )
                    { 
                    alert( "Record Deleted " + name0);
                    window.location.href = 'griddata.php';}
           );
          //  alert( "Record Deleted" + data );
      }
	}
        
	 function editdata(Referenceno,param2)
	{
		//alert(Referenceno);
		window.location.href = Referenceno;	
	}
	
	$(function() {
	$( "#fromdt" ).datepicker({ dateFormat: "dd-mm-yy" }).val()
	$( "#todt" ).datepicker({ dateFormat: "dd-mm-yy" }).val()
	});

 </script>
<td ><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">Transaction</label></td> 
<div  align="center">
	<div  ng-controller="MyCtrl">
	<div align="center">
			<form name="rst" method="post" action="viewgriddata.php">
			<table  cellpadding="0" id="special"  cellspacing="0" border="0" width="966" bgcolor="#FFFFFF" >
				<tr >
				  <td width="183" ><label style="text-align:left; font-size:14px;  font-weight:bold; vertical-align:middle;">From Date</label></td>
				  <td width="24" ><label style="text-align:left; font-size:14px; font-weight:bold; vertical-align:middle;">:</label></td>
					<td width="292" style="text-align:left; font-size:14px; font-weight:bold; vertical-align:middle;">
						<input type="text" name="fromdt" id="fromdt" value="<?=$f?>" class="smallInput"/>
				  </td>
				  <td width="143" class="nostyle" ><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">To Date</label></td>
				  <td width="23" class="nostyle" ><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">:</label></td>
					<td width="301" style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">
						<input type="text"  id="todt" name="todt" class="smallInput" value="<?=$t?>" />
				  </td>
				</tr>
				<tr>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">Customer/Dist Name</label></td>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">:</label></td>
					<td style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">
						<select  name="custid" id="custid" class="smallInput" style="width:250px; font-size:12px; font-weight:bold;" >
						<option value="0">ALL</option>
						<?
							$sqlct="select * from customermast where status=0 order by custdesc";
							$resct=mysql_query($sqlct);
							
							while($rowct=mysql_fetch_assoc($resct))
							{
								$s='';
								if($rowct['custid']==$_SESSION['custid'])
									$s='selected="selected"';	
								else
									$s='';
						?>
							<option  <?=$s?> value="<?=$rowct['custid']?>"><?=$rowct['custdesc']?></option>
						<?
							}
						?>	
						</select>
					</td>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">Nature of Business</label></td>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">:</label></td>
					<td style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">
						<select  name="bid" id="bid" class="smallInput" style="width:250px; font-size:12px; font-weight:bold;" >
						<option value="0">ALL</option>
						<?
							$sqlb="select * from businessmast where status=0 order by bdesc";
							$resb=mysql_query($sqlb);
							while($rowb=mysql_fetch_assoc($resb))
							{
							$s1='';
								if($rowb['bid']==$_SESSION['bid'])
									$s1='selected="selected"';	
								else
									$s1='';
						?>
							<option  <?=$s1?> value="<?=$rowb['bid']?>"><?=$rowb['bdesc']?></option>
						<?
							}
						?>	
						</select>
					</td>
				</tr>
				<tr>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">Sub-Agent Name</label></td>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">:</label></td>
					<td colspan="4" style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">
						<select  name="subid" id="subid" class="smallInput" style="width:250px; font-size:12px; font-weight:bold;" >
						<option value="0">ALL</option>
						<?
							$sqlcts="select * from subdealermast where status=0 order by subname";
							$rescts=mysql_query($sqlcts);
							while($rowcts=mysql_fetch_assoc($rescts))
							{
						?>
							<option value="<?=$rowcts['subid']?>"><?=$rowcts['subname']?></option>
						<?
							}
						?>	
						</select>
<!--						<input type="text"  id="datepick" name="datepick" class="smallInput" /> -->
					</td>
				</tr>
				<tr>
				<!--	<td><input type="text" ng-model="filterOptions.filterText" placeholder="filter..." /> </td> -->
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;"></label></td>
					<td><label style="text-align:left; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;"></label></td>
					<td colspan="4" style="text-align:right; font-size:14px; color:#333333; font-weight:bold; vertical-align:middle;">
						<input type="submit" name="submit" value="Search" class="btn btn-sm btn-info">

					</td>
				</tr>
			</table>
			</form>
	
	</div>
<!--    <br />

		OR
		</br>
		<strong>Reference No:</strong> </string>
		<input type="text" ng-model="Referenceno"/>	</br>      
		<button ng-click="activateFilter()"> Search </button>   <br/>
			<br/>
-->		  
				<div align="center">
					<a class="button" href="transaction.php"><span>Add New</span></a>
<!--					 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a ng-click="refreshGrid()"> Refresh Grid </a> -->
				</div><br />
                 
					 <div class="gridStyle" ng-grid="gridOptionsView"></div> 
                     
                    
	</div>
</div>
</body>
</html>
